#!/bin/bash

ROOT_UID=0

install()
{
	if [ "$UID" -eq "$ROOT_UID" ]
	then
		echo "You are root."
		if which apt-get >/dev/null; then
			apt-get install -y vim wget zip ctags
		elif which yum >/dev/null; then
			yum install -y vim wget unzip ctags
		elif which apk >/dev/null; then
			apk add -y vim wget unzip ctags
		fi
	else
		echo "You are just an ordinary user (but mom loves you as the same)."

		if which apt-get >/dev/null; then
			sudo apt-get install -y vim wget zip ctags
		elif which yum >/dev/null; then
			sudo yum install -y vim wget unzip ctags
		elif which apk >/dev/null; then
			apk add -y vim wget unzip ctags
		fi
	fi
}


vimconfig()
{
	cd ~
	rm -rf vim.zip
	wget -O "vim.zip" https://gitee.com/im997345483/vim/repository/archive/master.zip
	unzip vim.zip
	rm -rf ~/.vim
	rm -rf ~/.vimrc
	mv vim ~/.vim
	mv ~/.vim/.vimrc ~/.vimrc
}

cleardownload()
{
	cd ~
	rm -rf vim.zip
}

install
vimconfig
cleardownload

echo "vim config Done"

